#include<bits/stdc++.h>
using namespace std;
vector<int> vec;
vector<int> res[1100];
int a[1100];
int main()
{
	ios::sync_with_stdio(0);
	int T;cin>>T;
	while (T--)
	{
		int n;cin>>n;
		for (int i=1;i<=n;++i)
		{
			char ch;cin>>ch;
			a[i] = (int)(ch-'0');
		}
		int l = 1, r = n;
		while (l<=n&&a[l]==0)++l;
		while (r>=1&&a[r]==1)--r;
		vector<int> res1,res2;
		while (l<=r)
		{
			res1.push_back(r);
			res2.push_back(l);
			swap(a[l],a[r]);
			while (l<=n&&a[l]==0)++l;
			while (r>=1&&a[r]==1)--r;
		}
		reverse(res1.begin(),res1.end());
		if (res1.empty()&&res2.empty())cout<<"0\n";
		else{
			cout<<"1\n";
			cout<<res1.size()+res2.size()<<" ";
			for (int num:res2)cout<<num<<" ";for (int num:res1)cout<<num<<" ";cout<<endl;
		}
	}
}








if(suf[i+1]==0)
		{
			cout<<pre[i]*2<<" ";
			for(int j=1;j<=i;j++)
			{
				if(pos1.size()==pre[i]) break;
				if(a[j]==1) pos1.insert(j);
			}

			for(int j=n;j>i;j--)
			{
				if(pos0.size()==pre[i]) break;
				if(a[j]==0) pos0.insert(j);
			}
			for(auto&k:pos1) cout<<k<<" ";
			for(auto&k:pos0) cout<<k<<" ";
			cout<<'\n';
			return;
		}